home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / CASEDEMO.MOD < prev    next >
Text File  |  1989-01-18  |  2KB  |  61 lines

  1.                                          (* Chapter 4 - Program 6 *)
  2. MODULE CaseDemo;
  3.  
  4. FROM InOut IMPORT WriteString, WriteInt, WriteLn;
  5.  
  6. VAR Dummy : INTEGER;
  7.  
  8. BEGIN
  9.  
  10.    FOR Dummy := 1 TO 25 DO
  11.       WriteInt(Dummy,4);
  12.       WriteString("  ");
  13.       CASE Dummy OF
  14.          1..5        : WriteString("the number is small"); |
  15.          6..9        : WriteString("it is a little bigger"); |
  16.          10,11       : WriteString("it is 10 or 11"); |
  17.          14..17      : WriteString("it is midrange"); |
  18.          18,20,22,24 : WriteString("it is big and even"); |
  19.          19,21,23    : WriteString("it is big and odd");
  20.       ELSE
  21.          WriteString("The number didn't make the list");
  22.       END;  (* of CASE *)
  23.       WriteLn;
  24.    END;  (* of FOR loop *)
  25.  
  26. END CaseDemo.
  27.  
  28.  
  29.  
  30.  
  31. (* Result of execution
  32.  
  33.    1  the number is small
  34.    2  the number is small
  35.    3  the number is small
  36.    4  the number is small
  37.    5  the number is small
  38.    6  it is a little bigger
  39.    7  it is a little bigger
  40.    8  it is a little bigger
  41.    9  it is a ;ittle bigger
  42.   10  it is 10 or 11
  43.   11  it is 10 or 11
  44.   12  The number didn't make the list
  45.   13  The number didn't make the list
  46.   14  it is midrange
  47.   15  it is midrange
  48.   16  it is midrange
  49.   17  it is midrange
  50.   18  it is big and even
  51.   19  it is big and odd
  52.   20  it is big and even
  53.   21  it is big and odd
  54.   22  it is big and even
  55.   23  it is big and odd
  56.   24  it is big and even
  57.   25  The number didn't make the list
  58.  
  59. *)
  60.  
  61.